using UnityEngine;
using System.Collections;

public class Node : MonoBehaviour {
	
	public NodeDirection nodeDirection = NodeDirection.LeftAndRight;
	
	void OnTriggerEnter(Collider col){	
		if(col.tag=="Respawn") return;
		Bird bird = col.GetComponent<Bird>();
		if(nodeDirection==NodeDirection.LeftAndRight){
			int a = (int)bird.moveDirection;
			int b = Rand();
			if(a!=b){
				int c = Rand();
				bird.moveDirection = (MoveDirection)c;
			}
		}
		else
		{
			bird.moveDirection = (MoveDirection)((int)(nodeDirection));
		}
	}
	
	int Rand(){
		if(Random.value<0.5f){
			return 1;
		}
		return 0;
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

public enum NodeDirection{
	Left,
	Right,
	LeftAndRight
}